package com.magnificent.atlantis.client.data.message.messages;

import com.magnificent.atlantis.client.data.configuration.ServerConfiguration;
import com.magnificent.atlantis.common.entity.messages.ServerMeetingMessage;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import java.util.Date;

/**
 * User: Babanin
 * Date: 05.05.2009
 * Time: 1:07:44
 */
public abstract class ClientMeetingMessage extends ClientMessage {
    protected Date date;
    protected int meetingId;
    protected String comment;
    protected String meetingTitle;

    protected ClientMeetingMessage() {
    }

    public ClientMeetingMessage(ServerMeetingMessage serverMeetingMessage, ServerConfiguration configuration) {
        super(serverMeetingMessage, configuration);

        this.date = serverMeetingMessage.getDate();
        this.comment = serverMeetingMessage.getComment();
        this.meetingId = serverMeetingMessage.getEventId();
        this.meetingTitle = serverMeetingMessage.getTitle();
    }

    @XmlElement()
    public int getMeetingId() {
        return meetingId;
    }

    public void setMeetingId(int meetingId) {
        this.meetingId = meetingId;
    }

    @XmlElement()
    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    @XmlElement()
    public String getMeetingTitle() {
        return meetingTitle;
    }

    public void setMeetingTitle(String meetingTitle) {
        this.meetingTitle = meetingTitle;
    }

    @XmlAttribute()
    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public boolean isSystemMessage() {
        return true;
    }

    protected void copyDataTo(ServerMeetingMessage serverEventMessage) {
        super.copyDataTo(serverEventMessage);

        serverEventMessage.setDate(date);
        serverEventMessage.setComment(comment);
        serverEventMessage.setEventId(meetingId);
        serverEventMessage.setTitle(meetingTitle);
    }
}
